/*
 * @Description: 
 * @Author: lwx
 * @Date: 2022-11-07 14:07:37
 * @LastEditors: lwx
 * @LastEditTime: 2022-12-29 17:00:38
 */
const path = require('path')
const resolve = dir => {
    return path.join(__dirname, dir)
}
module.exports = {
    assetsDir: "static",
    lintOnSave: false,
    configureWebpack: config => {
        //引入@babel/polyfill'模块
        config.entry.app = ["@babel/polyfill", "./src/main.js"];
    },
    //配置不兼容的依赖文件,项目
    transpileDependencies: [
        'element-ui',
        //配置所有不兼容文件，会增加打包项目大小
        process.env.NODE_ENV === "development" ? ["*"] : [],
    ],
    chainWebpack: (config) => {
        //配置项目目录别名
        config.resolve.alias
            .set('@/components', resolve('src/components'))
            .set('@/common', resolve('src/common'))
            .set('@/api', resolve('src/api'))
            .set('@/assets', resolve('src/assets'))
            .set('@/utils', resolve('src/utils'))
            .set('@/views', resolve('src/views'))
            // 一个规则里的 基础Loader
            // svg是个基础loader
        const svgRule = config.module.rule("svg");
        svgRule.uses.clear();

        // 添加要替换的 loader
        svgRule
            .use("svg-sprite-loader")
            .loader("svg-sprite-loader")
            .options({
                symbolId: "icon-[name]",
            });
    },

};